﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;


public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        BLL.B_Login bll = new B_Login();
        Model.M_Login loginmodel = null;
        string strLogin = txtName.Text.Trim();
        string strPass = txtPassword.Text.Trim();
        if (txtName.Text.Trim() == "")
        {
            Response.Write("<script>alert('请输入用户名！')</script>");
        }
        else
            if (txtPassword.Text.Trim() == "")
            {
                Response.Write("<script>alert('请输入密码！')</script>");
            }
            else
            {
                if (bll.IsExists(strLogin, strPass, out loginmodel))
                {
                    Session["LoginName"] = strLogin;
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    Response.Write("<script>alert('登陆失败，请查询密码或用户名！')</script>");
                }
            }
 }
    protected void btnPass_Click(object sender, EventArgs e)
    {

    }
}